﻿using System;
using System.IO;
using System.Text;

namespace StreamReader和StreamWriter
{
	class Program
	{
		static void Main(string[] args)
		{
			string s1 = @"E:\壁纸\创建新文件.txt";
			//读取文件
			using (StreamReader sr= new StreamReader(s1,Encoding.UTF8))
			{
				while (!sr.EndOfStream)
				{
					Console.WriteLine(sr.ReadLine());
				}
			}
			//不覆盖的写法
			using (StreamWriter sw = new StreamWriter(@"E:\壁纸\newnew.txt",true))
			{
				sw.Write("今天天气好");
			}
			Console.WriteLine("写入");
			Console.ReadKey();

		}
	}
}
